package com.devunion.salon.client.app.mvc.controller;

import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.devunion.salon.client.app.mvc.view.ProductListView;
import com.devunion.salon.client.app.mvc.view.VendorView;
import com.devunion.salon.client.app.mvc.SalonEvents;

/**
 * Created by IntelliJ IDEA.
 * User: Andrei
 * Date: 08.03.2009
 * Time: 0:35:32
 * To change this template use File | Settings | File Templates.
 */
public class VendorController  extends Controller {

    public static final String VENDOR_LIST_CONTROLLER_ID = "VENDOR_LIST_CONTROLLER_ID";
    private VendorView view;

    protected void initialize() {
        view = new VendorView(this);
        registerEventTypes(SalonEvents.COMPONENT_INIT);
    }

    public void handleEvent(AppEvent<?> event) {
        if (event.data instanceof String) {
            String componentId = (String) event.data;
            if (componentId != null && componentId.equals(VENDOR_LIST_CONTROLLER_ID)) {
                forwardToView(view, event);
            }
        }
    }
}
